#include <stdio.h>

#if 0
// 传参和返回的本质就是一次赋值
typedef struct _myComplex
{
    float real;
    float image;

}MyComplex;

// 要实现一个函数，两个复数相加

MyComplex addComplex(MyComplex x,MyComplex y)
{
    MyComplex t;
    t.real = x.real + y.real;
    t.image = x.image + y.image;
    return t;
}
int main()
{
    MyComplex c1 ={1,2};
    MyComplex c2= {3,4};
    MyComplex retc = addComplex(c1,c2);
    printf("(%.2f,%.2f)\n", retc.real,retc.image);
//    printf("Hello World!\n");
    return 0;
}
#endif


// C 语言对于数组的处理，就是传指针。
// 对于结构体，推荐传指针。
struct _data
{
    int a;
    int b;
    char c;
    double d;
    float f;
    //......

};

// 传参和返回的本质就是一次赋值
typedef struct _myComplex
{
    float real;
    float image;

}MyComplex;

// 要实现一个函数，两个复数相加

MyComplex addComplex(MyComplex *px,MyComplex *py)
{
    MyComplex t;
    t.real = px -> real + py -> real;
    t.image = px -> image + py -> image;
    return t;
}
int main()
{
    MyComplex c1 ={1,2};
    MyComplex c2= {3,4};
    MyComplex retc = addComplex(&c1,&c2);
    printf("(%.2f,%.2f)\n", retc.real,retc.image);
//    printf("Hello World!\n");
    return 0;
}
